#!/usr/bin/env python
# -*- coding: utf-8 -*-
import uvicorn
import os

from core.app import create_app

# from config.app import settings

app = create_app()

if __name__ == "__main__":
    print("---------佛祖保佑 ---永不宕机 --- 永无BUG ----------")

    uvicorn.run(
        app='main:app',
        host=os.getenv('UVICORN_HOST', "0.0.0.0"),
        port=int(os.getenv('UVICORN_PORT', 8888)),
        reload=os.getenv('UVICORN_RELOAD', True),
        headers=[
            ("server", "web"),
            ("Set-Cookie", "Path=/; HttpOnly; Secure"),
            ("X-Content-Type-Options", "nosniff"),
            ("X-XSS-Protection", "1"),
            ("Content-Security-Policy",
             "default-src 'self'; style-src * 'unsafe-inline'; img-src * data:; object-src 'self'; script-src * "
             "'unsafe-eval' 'unsafe-inline'; font-src * data:; worker-src * blob:;"),
            ("Referrer-Policy", "no-referrer"),
            ("X-Permitted-Cross-Domain-Policies", "master-only"),
            ("X-Download-Options", "noopen"),
            ("X-Frame-Options", "SAMEORIGIN"),
            ("Strict-Transport-Security", "max-age=225")
        ]
    )
